<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
		<link rel="stylesheet" href="css/bootstrap.css">
		<title>银行管理系统</title>
	</head>
	<body>
		
		<table class="centerTable">
			<tr><td colspan="2"><h3>银行管理系统</h3></td></tr>
			<tr>
				<td>雇员ID：</td>
				<td><input type="text" class="search-query" id="employeeID" size="15"></td>
			</tr>
			<tr>
				<td>密码：</td>
				<td><input type="password" class="search-query" id="password" size="15"></td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td align="right"><input type="button" id="login" class="btn btn-primary" value="登录"></td>
			</tr>
		</table>
	</body>

	<script type="text/javascript">
	function centralization() {
		var tabletop = 200;
		if (($(window).height() - $(".centerTable").outerHeight()) / 2 < 64)
			tabletop = 64;
		$(".centerTable").css({
			position: "absolute",
			left: ($(window).width() - $(".centerTable").outerWidth()) / 2,
			top: tabletop
		});
	}
	$(function() {
		centralization();
		$(window).resize(function (){
			centralization();
		});
		$("#login").click(function() {
			$.ajax({
				url : "index",
				type : "POST",
				dataType : "text",
				data : {
					employeeID : $("#employeeID").val(),
					password : $("#password").val(),
					action: "LOGIN"
				},
				success : function (data) {
					r = confirm(data);
					
					if (r == true && data != "登录失败") {
						if (data.substring(8) == "ADMINISTRATOR")
							location.href = "administrator.jsp";
						else
							location.href = "employee.jsp";
					}
				}
			});
		});
	});
	</script>
</html>